<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/01/10
 * Time: 08:42 PM
 */

namespace Home\Controller;


use Think\Controller;

class LoginController extends Controller
{

    public function index(){

    }
    public function login(){
        $this->display("login");
    }

    public function checking()
    {
        $usernaem=$_POST['username'];
        $password = $_POST['password'];
        $result = M("admin")->where("username='" .$usernaem."'")->find();
        if($result)
        {
            if($result['password']==md5($password))
            {
                $_SESSION["ADMIN"]=$result;
                $this->redirect("/Admin/index");
//                $this->success("登陆成功","/__APP__/Index/index");
            }else
            {
                $this->error('账号密码错误','login');
            }
        }
        else {


            $this->error('账号密码错误', 'login');
        }
    }
}